package com.bjtime.designer.view

import android.support.v4.view.ViewPager
import android.view.View

class FDefaultTransformer : ViewPager.PageTransformer {

    override fun transformPage(view: View, position: Float) {

        var alpha = 0f
        if (0 <= position && position <= 1) {
            alpha = 1 - position
        } else if (-1 < position && position < 0) {
            alpha = position + 1
        }
        view.alpha = alpha
        val transX = view.width * -position
        view.translationX = transX
        val transY = position * view.height
        view.translationY = transY
    }

    companion object {
        val TAG = "simple"
    }
}
